package org.example.projecttwo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 友情链接表
 * </p>
 *
 * @author nn
 * @since 2025-11-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("friend_link")
@Schema(name="FriendLink对象", description="友情链接表")
public class FriendLink implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "主键ID（雪花算法）")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "链接编号")
    @TableField("link_no")
    @NotBlank(message = "链接编号不能为空")
    @Size(max = 20, message = "链接编号长度不能超过20个字符")
    private String linkNo;

    @Schema(description = "链接名称")
    @TableField("name")
    @NotBlank(message = "链接名称不能为空")
    @Size(max = 50, message = "链接名称长度不能超过50个字符")
    private String name;

    @Schema(description = "链接地址")
    @TableField("url")
    @NotBlank(message = "链接地址不能为空")
    @Size(max = 255, message = "链接地址长度不能超过255个字符")
    private String url;

    @Schema(description = "Logo图片URL")
    @TableField("logo_url")
    @Size(max = 255, message = "Logo图片URL长度不能超过255个字符")
    private String logoUrl;

    @Schema(description = "链接描述")
    @TableField("description")
    @Size(max = 200, message = "链接描述长度不能超过200个字符")
    private String description;

    @Schema(description = "排序序号")
    @TableField("sort_order")
    private Integer sortOrder;

    @Schema(description = "是否显示")
    @TableField("is_show")
    @NotNull(message = "显示状态不能为空")
    private Integer isShow = 0;

    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


}